package com.baiwei.mapper;

import com.baiwei.pojo.Orders;
import com.baiwei.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrdersMapper {
    /**
     * 查询所有
     * @return
     */
    @Select("select* from orders")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "ordertime", column = "ordertime"),
            @Result(property = "total", column = "total"),
            @Result(property = "user", column = "uid", javaType = User.class,
                    one = @One(select = "com.baiwei.mapper.UserMapper.findById"))
    })
    public List<Orders> findAll();

    @Select("select* from orders where uid=#{uid}")
    public List<Orders> findByUid();
}
